/*
 * $Id: AppEnv.h,v 1.3 2007/06/21 10:49:01 baconevi Exp $
 *
   Copyright 2005-2009 Chung, Hyung-Hwan.

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an  BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
 */

#ifndef _APPENV_CLASS_
#define _APPENV_CLASS_

#include <xp/bas/String.hpp>
#include <xp/utl/SkvEnv.hpp>
#include <xp/utl/SkvEnvPath.hpp>
#include <xp/net/TcpAddress.hpp>
#include <xp/sys/Path.hpp>
#include <xp/bas/time.h>

using namespace xp::bas;
using namespace xp::utl;
using namespace xp::net;
using namespace xp::sys;

class AppEnv: public SkvEnv 
{
public:
	AppEnv (xp_size_t mpb_size = 0);

	void preLoad ();
	void postLoad ();

	bool gateEnableTcp () const
	{
		return gate_enable_tcp;
	}

	const xp_char_t* gateTcpService () const 
	{
		return gate_tcp_service;
	}

	bool gateTcpLocalOnly () const
	{
		return gate_tcp_local_only;
	}

	unsigned int gateMaxConnections () const
	{
		return gate_max_connections;
	}

	xp_time_t gateTimeout () const
	{
		return gate_timeout;
	}

protected:
	bool gate_enable_tcp;

	xp_char_t gate_tcp_service[TcpAddress::MAX_SERVICE_LEN];
	bool gate_tcp_local_only;
	unsigned int gate_max_connections;
	xp_time_t gate_timeout;

private:
	int probe_logging_target       (const xp_char_t* v);
	int probe_logging_level        (const xp_char_t* v);

	int probe_gate_enable_tcp      (const xp_char_t* v);
	int probe_gate_tcp_service     (const xp_char_t* v);
	int probe_gate_tcp_local_only  (const xp_char_t* v);
	int probe_gate_max_connections (const xp_char_t* v);
	int probe_gate_timeout         (const xp_char_t* v);
};

typedef SkvEnvPath AppEnvPath;

#endif
